package com.stxx.assistant.framwork.constants;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Fuzhenlei
 * @date 2025/01/17 13:09
 */
public enum DataType implements IEnum<DataType>{
    STRING("string",String.class),
    INTEGER("integer",Integer.class),
    BOOLEAN("boolean",Boolean.class),
    DECIMAL("decimal",BigDecimal.class),
    LONG("long",Long.class);
    Class<?> type;
    String code;
    DataType(String name,Class<?> type){
        this.code = name;
        this.type = type;
    }

    public Class<?> getType(){
        return type;
    }

    public static List<String> getList(){
        return Arrays.stream(DataType.values()).map(item->item.code).collect(Collectors.toList());
    }

    @Override
    public String toString(){
        return code;
    }

}
